package com.tancire.web.controller.app;

import com.tancire.common.core.controller.BaseController;
import com.tancire.common.core.page.TableDataInfo;
import com.tancire.common.enums.GoodsStatus;
import com.tancire.net.domain.ShopGoods;
import com.tancire.net.service.IShopGoodsService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品管理Controller
 *
 * @author chenchao
 * @date 2023-11-20
 */
@RestController
@RequestMapping("/net/app/shop")
public class NetShopGoodsAppController extends BaseController {

    @Resource
    private IShopGoodsService shopGoodsService;

    /**
     * 查询商品管理列表
     */
    @PreAuthorize("@ss.hasPermi('net:user:union')")
    @GetMapping("/goods/list")
    public TableDataInfo list(ShopGoods shopGoods) {
        // 查询已经上架的
        shopGoods.setStatus(GoodsStatus.LISTED.getCode());
        startPage();
        List<ShopGoods> list = shopGoodsService.selectShopGoodsList(shopGoods);
        return getDataTable(list);
    }

}
